﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Drawing;

namespace EcSalseManage.PageCommon
{
    public partial class Report_Tab : System.Web.UI.UserControl
    {
        private string actionType = "1";
        protected void Page_Load(object sender, EventArgs e)
        {
            actionType = Request.QueryString["actionType"] == null ? "1" : Request.QueryString["actionType"].ToString();
            if (!IsPostBack)
            {
                if (ExchangeTypeID != "11")
                {
                    this.lbtnCommission.Visible = false;
                }
                switch (actionType)
                {
                    case "1":
                        this.lbtnReport.ForeColor = Color.FromArgb(255, 102, 0);
                        break;
                    case "2":
                        this.lbtnCommission.ForeColor = Color.FromArgb(255, 102, 0);
                        break;
                    case "4":
                        this.lbtnLog.ForeColor = Color.FromArgb(255, 102, 0);
                        break;
                }
            }
 
        }

        public string ExchangeTypeID
        {
            get
            {
                return (string)ViewState["ExchangeTypeID"];
            }
            set
            {
                ViewState["ExchangeTypeID"] = value;
            }
        }


        public string MainID
        {
            get
            {
                return (string)ViewState["MainID"];
            }
            set
            {
                ViewState["MainID"] = value;
            }
        }

        protected void lbtnReport_Click(object sender, EventArgs e)
        {
            switch (ExchangeTypeID)
            {
                case "1":
                    this.Response.Redirect("Report_Plan_Detail.aspx?id=" + MainID + "&actionType=1", true);
                    break;
                case "2":
                    this.Response.Redirect("Report_SalesAlone_Detail.aspx?id=" + MainID + "&actionType=1&typeid=2", true);
                    break;
                case "3":
                    this.Response.Redirect("Report_SalesLink_Detail.aspx?id=" + MainID + "&actionType=1&typeid=3", true);
                    break;
                case "4":
                    this.Response.Redirect("Report_BuyStandAlone_Detail.aspx?id=" + MainID + "&actionType=1&typeid=4", true);
                    break;
                case "5":
                    this.Response.Redirect("Report_Change_Detail.aspx?id=" + MainID + "&actionType=1&typeid=5", true);
                    break;
                case "6":
                    this.Response.Redirect("Report_Change_Detail.aspx?id=" + MainID + "&actionType=1&typeid=6", true);
                    break;
                case "7":
                    this.Response.Redirect("Report_Change_AreaUnit_Detail.aspx?id=" + MainID + "&actionType=1&typeid=7", true);
                    break;
                case "8":
                    this.Response.Redirect("Report_Change_AreaUnit_Detail.aspx?id=" + MainID + "&actionType=1&typeid=8", true);
                    break;
                case "9":
                    this.Response.Redirect("Report_Change_ReduceUnit_Detail.aspx?id=" + MainID + "&actionType=1", true);
                    break;
                case "10":
                    this.Response.Redirect("Report_ChangeOperater_Detail.aspx?id=" + MainID + "&actionType=1", true);
                    break;
                case "11":
                    this.Response.Redirect("Project_Detail.aspx?ProjectID=" + MainID + "&actionType=1", true);
                    break;
            }
           
        }



        protected void lbtnLog_Click(object sender, EventArgs e)
        {
            this.Response.Redirect("Report_Log.aspx?id=" + MainID + "&actionType=4&typeid="+ExchangeTypeID, true);
        }

        protected void lbtnCommission_Click(object sender, EventArgs e)
        {
            this.Response.Redirect("Project_Commission.aspx?id=" + MainID + "&actionType=2&typeid=" + ExchangeTypeID, true);
        }
    }
}